'use strict'
const { query } = require('../app/helper/db');

module.exports.up = function (next) {
  query(`
    CREATE TABLE orderProduct (
      id int(11) unsigned NOT NULL AUTO_INCREMENT,
      productid int(11) unsigned NOT NULL comment '',
      orderid int(11) unsigned NOT NULL comment '',
      name varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL comment '',
      categoryName varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL comment '',
      createdat int(11) NOT NULL comment '',
      PRIMARY KEY (id)
    ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
  `).then(() => {
    next();
  }).catch(err => {
    throw err;
  })
}

module.exports.down = function (next) {
  next()
}
